package com.hsh.maoduo.controller;

import com.hsh.maoduo.common.Result;
import com.hsh.maoduo.pojo.dto.OrderGoodsDTO;
import com.hsh.maoduo.pojo.vo.OrderGoodsVO;
import com.hsh.maoduo.service.OrderGoodsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderGoodsController {


    @Resource
    private OrderGoodsService orderGoodsService;

    @GetMapping("/list")
    public List<OrderGoodsDTO> getList(OrderGoodsVO orderGoodsVO) {
        return orderGoodsService.getList(orderGoodsVO);
    }

    @GetMapping("/export")
    public Integer export(OrderGoodsVO orderGoodsVO) {
        return orderGoodsService.export(orderGoodsVO);
    }

    @PostMapping("/addList")
    public Result addList(@RequestBody List<OrderGoodsVO> orderGoodsVOList) {
        return orderGoodsService.addList(orderGoodsVOList);
    }

    @PostMapping("/update")
    public Result update(OrderGoodsVO orderGoodsVO) {
        return orderGoodsService.update(orderGoodsVO);
    }

    @PostMapping("/delete")
    public Result delete(int id) {
        return orderGoodsService.delete(id);
    }
}
